<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jquery-3.4.1.js"></script>
</head>

<body>
    <img src="" alt="" data-index='10'>
    <button></button>
    <script>
        $('button').click(function(){
            $('img').prop('src','')

            console.log($('img').attr('data-index'))
            $('img').attr('data-num',200);
        })
    </script>
</body>
</html>